def find_max_circular_subarray_sum(arr):
    n = len(arr)
    if n == 0:
        return 0, -1, -1
    max_sum = float('-inf')
    start_idx = 0
    end_idx = 0

    for i in range(n):
        current_sum = 0
        current_start = i
        for j in range(n):
            idx = (i + j) % n
            current_sum += arr[idx]
            if current_sum > max_sum:
                max_sum = current_sum
                start_idx = current_start
                end_idx = idx

    return max_sum, start_idx, end_idx

def read_array_from_file(file_path):
    try:
        with open(file_path, 'r') as file:
            arr = list(map(int, file.readline().split()))
            # 确保元素个数不超过100个
            if len(arr) > 100:
                arr = arr[:100]
            return arr
    except FileNotFoundError:
        print(f"文件 {file_path} 不存在")
        return []
    except Exception as e:
        print(f"读取文件时发生错误: {e}")
        return []

# 示例用法
file_path = 'array.txt'  # 请替换为实际的文件路径
arr = read_array_from_file(file_path)
if arr:
    max_sum, start, end = find_max_circular_subarray_sum(arr)
    print(f"最大子数组和: {max_sum}")
    print(f"起始下标: {start}, 结束下标: {end}")